<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1" import="java.sql.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>

<%
Connection conn=null;
Statement stmt=null;
try{
	Class.forName("com.mysql.jdbc.Driver");
}
catch(ClassNotFoundException e){
	System.out.print("la classe est introuvale");
	e.printStackTrace();
	}
try{
	String url="jdbc:mysql://localhost:3306/base_labrocante";
	String user="root";
	String pw="";
	conn=DriverManager.getConnection(url,user,pw);
	stmt = conn.createStatement();
	String req1="SELECT * FROM annonce ORDER BY idAnnonce ASC";	
	// ( '"+nom+"','"+prenom+"',"+tel+",'"+email+"','"+dateN+"','"+login+"','"+password+"')
	ResultSet rset = stmt.executeQuery(req1);
%>

<form>
<table border="1">
		<tr>
			<th>Titre </th>
			<th>Annonce Description </th>
			<th>Telephone </th>
			<th>prix </th>
			<th>ville </th>
			<th>Categorie </th>
			<th colspan="2">Action</th>
		</tr>
		<%while(rset.next()){ %>
		<tr>
			<td><% out.print(rset.getString("titre"));%></td>
			<td><%out.print(rset.getString("texteAnnonce")); %></td>
			<td><%out.print(rset.getInt("tel")); %></td>
			<td><%out.print(rset.getFloat("prix")); %></td>
			<td><%out.print(rset.getString("ville")); %></td>
			<td><%out.print(rset.getString("categorie")); %></td>
			<td><a href="updateAnnonce_1.jsp?idannonce=<%=rset.getString("idAnnonce")%>">Update</a></td>
			<td><a href="deleteAnnonce_1.jsp?idannonce=<%=rset.getString("idAnnonce")%>">Delete</a></td>
		</tr>
		<%} %>
</table>
</form>
<%
}
catch(SQLException e){
e.printStackTrace();
}
%>

<p><a href="insertAnnonce_1.jsp">insert Annonce</a></p>
</body>
</html>